#ifndef QVARPROPERTY_H
#define QVARPROPERTY_H
#include <QObject>
#include "qabstractproperty.h"
#include "qenumproperty.h"
#include "qtagproperty.h"
#include "qstringproperty.h"

class QVarProperty : public QAbstractProperty
{
    Q_OBJECT
    Q_PROPERTY(QVariant value READ getProValue WRITE setValue)
    Q_PROPERTY(QString dataType READ getDataType WRITE setDataType)

public:
    Q_INVOKABLE QVarProperty(QAbstractProperty *parent = 0);

    QString getValueText() override;
    QIcon getValueIcon() override;

    void setValue(const QVariant &value) override;
    void setDataType(QString dataType);
    QString getDataType();
    QVariant getProValue();
    void fromObject(XMLObject *xml) override;

protected:
    void makeValue() override;
    void writeValue() override;
    void initChildProperties();
public slots:
    void child_value_changed(const QVariant& old, const QVariant &now,const QString propertyName) override;

signals:
    void property_changed();

private:
    QEnumProperty *m_varType;  //属性类型   RealData 0,Setting 1
    QTagProperty *m_varTag; //如果是绑定RealData，绑定参数标识
    QAbstractProperty *m_varValue; //手工输入参数值
    QString m_dataType;  //数据类型，与varValue的类型关联。
};

#endif // QVARPROPERTY_H
